package com.macro.mall.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.dto.UmsMemberParam;
import com.macro.mall.model.UmsMember;
import com.macro.mall.service.UmsMemberService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;

@Controller
@Api(tags = "umsMember")
@Tag(name = "umsMember", description = "会员管理")
@RequestMapping("/umsMember")
public class UmsMemberController {
	
	@Autowired
	private UmsMemberService umsMemberService;
	
    @ApiOperation("分页岗位")
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    @ResponseBody
    public CommonResult<CommonPage<UmsMember>> getList(@RequestBody UmsMemberParam umsMemberParam) {
        List<UmsMember> umsMemberList = umsMemberService.getList(umsMemberParam);
        return CommonResult.success(CommonPage.restPage(umsMemberList));
    }
    
    @ApiOperation("根据id获取岗位")
    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    @ResponseBody
    public CommonResult<UmsMember> getItem(@PathVariable Long id) {
    	UmsMember umsMember = umsMemberService.getItem(id);
        return CommonResult.success(umsMember);
    }

}
